package com.hrm.service.impl;

import com.hrm.dao.HrmApartmentMapper;
import com.hrm.dao.HrmPostMapper;
import com.hrm.dao.HrmStaffMapper;
import com.hrm.dao.HrmUserMapper;
import com.hrm.model.HrmApartment;
import com.hrm.model.HrmPost;
import com.hrm.model.HrmUser;
import com.hrm.service.HrmUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service("hrmUserService")
public class HrmUserServiceImpl implements HrmUserService {
    @Autowired
    protected HrmUserMapper hrmUserMapper;
    @Autowired
    protected HrmStaffMapper hrmStaffMapper;
    @Autowired
    protected HrmApartmentMapper hrmApartmentMapper;
    @Autowired
    protected HrmPostMapper hrmPostMapper;

    @Override
    public HrmUser login(String username, String password) {
        return hrmUserMapper.checkLogin(username,password);
    }

    @Override
    public int updateUser(HrmUser hrmUser){

        return hrmUserMapper.updateByPrimaryKeySelective(hrmUser);
    }

    @Override
    public HrmUser getHrmUser(Integer id) {
        return hrmUserMapper.selectByPrimaryKey(id);
    }

    public Integer updatePsw(String OldPsw,String NewPsw,Integer id){
        return hrmUserMapper.updatePsw(OldPsw,NewPsw,id);
    }
}
